Skip to content

Count provider-owned windows on AppKit, not listed ones - #31

Merged
bytetroll merged 1 commit into
masterfrom
appkit-owned-window-count
Nov 9, 2026
Merged

bytetroll merged 1 commit into
masterfrom
appkit-owned-window-count

Conversation

@bytetroll

Copy link
Copy Markdown
Contributor

The diagnostics settled it: "UI lifecycle VM window" content=NyUiContainer visible=0 released_when_closed=0 refs=24. The window was closed and the provider had let go; AppKit was holding it, through twenty-four references, and no amount of settling was going to change that.

So the metric was wrong, not the provider. Two AppKit facts break the GTK-shaped question. A closed window stays in the application's window list until it deallocates, which AppKit defers indefinitely, and the lifecycle fixture never orders its window in, so isVisible cannot separate a live window from a released one either -- both read false.

The provider does leave a usable marker: it installs a delegate when it creates a window and clears it on every release path -- close, dispose and the creation rollback. Counting its own content views that still have a delegate asks exactly what the fixture means, has the provider let this window go, and stays independent of the provider's handle map, which is what a stale handle could otherwise hide. The assertions and their count are unchanged, so the fixture still reports the 235 checks the display contract requires.

My two earlier attempts at this failure -- a run-loop turn, then a bounded settle -- were both wrong, and both were theories the evidence then contradicted. This one follows from what the run actually printed.

The diagnostics settled it: "UI lifecycle VM window" content=NyUiContainer
visible=0 released_when_closed=0 refs=24. The window was closed and the
provider had let go; AppKit was holding it, through twenty-four
references, and no amount of settling was going to change that.

So the metric was wrong, not the provider. Two AppKit facts break the
GTK-shaped question. A closed window stays in the application's window
list until it deallocates, which AppKit defers indefinitely, and the
lifecycle fixture never orders its window in, so isVisible cannot
separate a live window from a released one either -- both read false.

The provider does leave a usable marker: it installs a delegate when it
creates a window and clears it on every release path -- close, dispose
and the creation rollback. Counting its own content views that still
have a delegate asks exactly what the fixture means, has the provider
let this window go, and stays independent of the provider's handle map,
which is what a stale handle could otherwise hide. The assertions and
their count are unchanged, so the fixture still reports the 235 checks
the display contract requires.

My two earlier attempts at this failure -- a run-loop turn, then a
bounded settle -- were both wrong, and both were theories the evidence
then contradicted. This one follows from what the run actually printed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bytetroll
bytetroll merged commit 3400097 into master Nov 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant